package com.zw.admin.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zw.admin.server.model.PPurchOrderItems;

@Mapper
public interface PPurchOrderItemsDao {

    @Select("select * from p_purch_order_items t where t.id = #{id}")
    PPurchOrderItems getById(Long id);

    @Delete("delete from p_purch_order_items where id = #{id}")
    int delete(Long id);

    int update(PPurchOrderItems pPurchOrderItems);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into p_purch_order_items(order_id, item_no, goods_name, sku, buydate, qty, receive_qty, pre_buy_price, createTime, updateTime) values(#{orderId}, #{itemNo}, #{goodsName}, #{sku}, #{buydate}, #{qty}, #{receiveQty}, #{preBuyPrice}, #{createTime}, #{updateTime})")
    int save(PPurchOrderItems pPurchOrderItems);
    
    int insert(PPurchOrderItems pPurchOrderItems);
    
    int count(@Param("params") Map<String, Object> params);

    List<PPurchOrderItems> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
    
    
    List<PPurchOrderItems> listOrderId (@Param("orderId") Long orderId);
    
}
